public class TextIssues2 {
    public static void main(String[] args) {
        fun(1234);
    }
    public static void   fun(int n){
        if (n < 10 && n > 0){
            System.out.print(n + " ");
        }else {
            fun(n / 10);
            System.out.print(n % 10 + " ");
        }
    }


    public static void main1(String[] args) {
        int num = 123;
        int count = 1;
        int temp = num;
        while (temp / 10 != 0){
            count++;
            temp /= 10;
        }

        for (int i = 1; i <= count ; i++) {
            System.out.print(num % 10 + " ");
            num /= 10;
        }
    }
}
